--- interact_link: content/main.ipynb kernel_name: python3 kernel_path: content has_widgets: false title: |- Summary pagenum: 0 prev_page: url: next_page: url: /berlin.html suffix: .ipynb search: cases reported data country deaths daily countries total curves variation covid days rate figure shows outbreak analyze com week plotly list realistic estimates death following double click name legend switch mortality short report created using jupyter book tries visualize related constantly updated repository johns hopkins ccse github cssegisanddata work progress graphs addedd next bar chart displaying interactive charts same considered page below europe strongly dependent capacity politics terms tests only obtained starting nevertheless provide measure spread virus shifting start infected persons reached also smoothed taking average before after isolate its simple clicking off corresponding show whether different able flatten try comment: "***PROGRAMMATICALLY GENERATED, DO NOT EDIT. SEE ORIGINAL FILES IN /content***" ---
Summary

COVID-19 Outbreak Data

This short report has been created using Jupyter Book and tries to visualize and analyze some data related to the COVID-19 outbreak.

The data are constantly updated from the repository by Johns Hopkins CCSE.

This is a work-in-progress, graphs will be addedd in the next days and week.

We use plotly bar chart for displaying the interactive charts.

List of countries

We can analyze one or more countries at the same time. You can see the list of the countries considered in this page below.

import os,sys
sys.path.insert(0, os.path.normpath(os.path.join(os.path.abspath(''), '../../Code')))
from hedera_covid import DataHandler, plot_death_rate, plot_daily_cases, plot_confirmed_cases



# for plotly
from plotly.offline import iplot
from plotly.offline import init_notebook_mode, plot
from IPython.core.display import display, HTML
import plotly as py
import plotly.tools as tls

import numpy as np

# load data
path_confirmed = '../../Data/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_global.csv'
path_death = '../../Data/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_deaths_global.csv'

europe_covid_data = DataHandler(data_confirmed_path = path_confirmed,data_death_path = path_death)
america_covid_data = DataHandler(data_confirmed_path = path_confirmed,data_death_path = path_death)

Europe

Europe = ['Italy','Spain','Germany','France','United Kingdom',
          'Netherlands','Belgium','Portugal','Sweden','Austria']

for c in Europe:
    europe_covid_data.add_country(c)

Total number of cases

The number of (reported) cases is strongly dependent on the capacity and on the politics of each country in terms of tests. Realistic estimates can only be obtained starting from (realistic estimates of) the number of deaths and of the death rate.

Nevertheless, the number of reported cases can provide a measure of the spread of the virus.

The following figure shows the number of reported cases, shifting the curves so that they start when the number of infected persons reached 100. The number has also been smoothed taking, for each day, the average of a week (3 days before and 3 days after).

You can double click on a country name on legend to isolate its data. Simple clicking on a name will switch on/off the corresponding data.

# confirmed
data = europe_covid_data.get_confirmed_data(start_date=0,n_smooth=0,rescale=True)
covid_data = europe_covid_data
init_notebook_mode(connected=True)

fig = {
    "data": data,
    "layout": {"title": {"text": "Confirmed Cases (rescaled in each country)"}}
}

plot(fig, filename = 'figure.html')
display(HTML('figure.html'))

Daily variation

data = europe_covid_data.get_daily_confirmed_data(start_date=0,n_smooth=7,rescale=True)
init_notebook_mode(connected=True)

fig = {
    "data": data,
    "layout": {"title": {"text": "Daily Cases (rescaled)"}}
}

plot(fig, filename = 'figure.html')
display(HTML('figure.html'))

These curves show whether and how the different countries are able to flatten the curves. Try to double-click on the legend, then switch on, country by country, Italy, Germany, and Spain.

Number of deaths

Total

The figure shows the total number of deaths over time.

data = europe_covid_data.get_deaths_data(start_date=40,n_smooth=7,rescale=False)
init_notebook_mode(connected=True)

fig = {
    "data": data,
    "layout": {"title": {"text": "Daily deaths (rescaled)"}, "legend_orientation": "h", 
              "legend" :{"x":0.3, "y": 1.15}
              }
}

plot(fig, filename = 'figure.html')
display(HTML('figure.html'))

Daily variation

To look at the daily variation, we can rescale the curves setting the first day when at least 5 deaths were reported.

data = europe_covid_data.get_daily_deaths_data(start_date=0,n_smooth=7,rescale=True)
init_notebook_mode(connected=True)

fig = {
    "data": data,
    "layout": {"title": {"text": "Daily deaths (rescaled)"}, "legend_orientation": "h"}
}
plot(fig, filename = 'figure.html')
display(HTML('figure.html'))

Mortality Rate

The following figure shows the mortality rate (# of reported death/# of reported cases) for each country/

data = europe_covid_data.get_death_rate_data(start_date=40,n_smooth=0,rescale=False)
init_notebook_mode(connected=True)

fig = {
    "data": data,
    "layout": {"title": {"text": "Daily deaths (rescaled)"},
               "font_size":10,
              "legend": {'x':1.05}
              }
}
plot(fig,filename = 'figure.html')
display(HTML('figure.html'))

Americas

America = ['US','Canada','Mexico','Colombia','Peru',
          'Chile','Brazil','Ecuador','Argentina']

for c in America:
    america_covid_data.add_country(c)

Total confirmed cases

# confirmed
data = america_covid_data.get_confirmed_data(start_date=0,n_smooth=0,rescale=True)

init_notebook_mode(connected=True)

fig = {
    "data": data,
    "layout": {"title": {"text": "Daily deaths (rescaled)"}, "legend_orientation": "h"}
}

plot(fig, filename = 'figure.html')
display(HTML('figure.html'))

Daily variation

data = america_covid_data.get_daily_confirmed_data(start_date=0,n_smooth=7,rescale=True)
init_notebook_mode(connected=True)

fig = {
    "data": data,
    "layout": {"title": {"text": "Daily Cases (rescaled)"}}
}

plot(fig, filename = 'figure.html')
display(HTML('figure.html'))

Daily deaths

data = america_covid_data.get_daily_deaths_data(start_date=0,n_smooth=7,rescale=True)
init_notebook_mode(connected=True)

fig = {
    "data": data,
    "layout": {"title": {"text": "Daily deaths (rescaled)"}, "legend_orientation": "h"}
}
plot(fig, filename = 'figure.html')
display(HTML('figure.html'))